// ts中同样可以用class定义对象，
// 只不过是对对象里的属性和方法多了类型的约束

class People {
    name: string
    age: number
    constructor(name: string, age: number) {
        this.name = name
        this.age = age

    }
    say(): void {
        console.log(this.name + "会说话");

    }
}

let xiaoli = new People("小丽", 18)
xiaoli.say()